package ooday04;

public class Test1 {
    public static void main(String[] args) {
        Animal[] animal = new Animal[5];
        animal[0] = new Dog("阿拉斯加",2,"灰");
        animal[1] = new Dog("秋田犬",2,"黄");
        animal[2] = new Fish("金龙鱼",2,"金");
        animal[3] = new Fish("鲸鱼",2,"蓝");
        animal[4] = new Chick("红腹锦鸡",2,"红");
        for (int i = 0;i<animal.length;i++){
            animal[i].eat();
            animal[i].drink();
            if (animal[i] instanceof Dog){
               Dog dog = (Dog) animal[i];
               dog.lookHome();
            }
            if(animal[i] instanceof Chick){
                Chick chick = (Chick) animal[i];
                chick.layEggs();
            }
            if(animal[i] instanceof InterFaceDemo2){
                InterFaceDemo2 swim = (InterFaceDemo2) animal[i];
                swim.swim();
            }
        }
       Mastrer mastrer = new Mastrer();
        Dog dog = new Dog("阿拉斯加",1,"灰");
        Fish fish = new Fish("金龙鱼",3,"金");
        Chick chick = new Chick("红腹锦鸡",2,"红");
        mastrer.feed(dog);
        mastrer.feed(fish);
        mastrer.feed(chick);

    }
}
